package base.items;

import java.util.HashSet;

/**
 * The Mp3 {@code class}. Create Mp3 object extended from a Music.
 * 
 * @author Peter NGO, Guillaume POUSSEL and Mathieu RUL
 * 
 * @version 1.0
 */
public class Mp3 extends Music {

	/**
	 * Bitrate of the Mp3.
	 */
	private int bitrate;

	/**
	 * Constructor of the {@code class}. Create a Mp3 from an ID.
	 * 
	 * @param ID
	 *            the Mp3 ID.
	 */
	public Mp3(Integer ID) {
		super(ID);
		setType("Mp3");
	}

	/**
	 * Constructor of the {@code class}. Create a Mp3 from parameter.
	 * 
	 * @param ID
	 *            the Mp3 ID.
	 * 
	 * @param title
	 *            the Mp3 title.
	 *            
	 * @param tags
	 *            the Mp3 tags.
	 *            
	 * @param comments
	 *            the Mp3 comments.
	 *            
	 * @param artist
	 *            the Mp3 artist.
	 *            
	 * @param length
	 *            the Mp3 length.
	 *            
	 * @param bitrate
	 *            the Mp3 bitrate.
	 */
	public Mp3(Integer ID, String title, HashSet<Integer> tags,
			HashSet<Integer> comments, String artist, double length, int bitrate) {
		super(ID, title, tags, comments, artist, length);
		setType("Mp3");
		this.bitrate = bitrate;
	}

	/**
	 * Returns a {@code String} array with the allowed MIME types for a Mp3.
	 * 
	 * @return a string array with the allowed MIME.
	 */
	@Override
	public String[] allowedMimeTypes() {
		return new String[] { "audio/mpeg" };
	}

	/**
	 * Get the bitrate of the Mp3.
	 * 
	 * @return the bitrate.
	 */
	public int getBitrate() {
		return bitrate;
	}

	/**
	 * Return {@code false}.
	 * 
	 * @return {@code false}.
	 */
	public boolean parseData() {
		return false;
	}

	/**
	 * Set the bitrate of the Mp3.
	 * 
	 * @param bitrate
	 *            the bitrate to set.
	 */
	public void setBitrate(int bitrate) {
		this.bitrate = bitrate;
	}

	/**
	 * Returns a {@code String} object representing the Mp3's value.
	 * 
	 * @return a string representation of the Mp3.
	 */
	@Override
	public String toString() {
		return super.toString() + "\nBitrate: " + bitrate + " kbps";
	}
}
